#include <stdio.h>
#include <pthread.h>
#include <unistd.h>

void *thread_main(void *arg);

int main(int argc, char *argv[])
{
    pthread_t t_id;
    int thread_param = 5;
    pthread_create(&t_id, NULL, thread_main, &thread_param);
    sleep(8);
    puts("主函数结束");
    return 0;
}

void *thread_main(void *arg)
{
    int cnt = *((int *)arg);
    for(int i = 0;i < cnt;++i) {
        sleep(1);
        printf("执行线程 %d 次\n", i + 1);
    }
    return NULL;
}

